Modify client-side behavior#4563
Conversation
e891783 to
f42e189
Compare
f42e189 to
b070304
Compare
392d25e to
e04b989
Compare
| import ( | ||
| "context" | ||
| "fmt" | ||
| "github.com/netbirdio/netbird/client/internal/statemanager" |
There was a problem hiding this comment.
Please keep the order of the imported packages as usual
| c.engineMutex.Lock() | ||
| c.engine = NewEngine(engineCtx, cancel, signalClient, mgmClient, relayManager, engineConfig, mobileDependency, c.statusRecorder, checks) | ||
| if loginResp.PeerConfig != nil && loginResp.PeerConfig.AutoUpdate != nil { | ||
| if c.engine.updateManager == nil && loginResp.PeerConfig.AutoUpdate.Version != "disabled" { |
There was a problem hiding this comment.
Where does this string come from? It should be const
| c.engineMutex.Lock() | ||
| c.engine = NewEngine(engineCtx, cancel, signalClient, mgmClient, relayManager, engineConfig, mobileDependency, c.statusRecorder, checks) | ||
| if loginResp.PeerConfig != nil && loginResp.PeerConfig.AutoUpdate != nil { | ||
| if c.engine.updateManager == nil && loginResp.PeerConfig.AutoUpdate.Version != "disabled" { |
There was a problem hiding this comment.
Code duplication with the engine. Move this logic into a function
|
Please fix the build issues |
| return u | ||
| } | ||
|
|
||
| func (u *UpdateManager) StartWithTimeout(ctx context.Context, timeout time.Duration) { |
There was a problem hiding this comment.
What will happen to the fetcher after a timeout? It seems like it will never be freed
There was a problem hiding this comment.
Since timeout will cancel the context, onContextCancel will handle fetcher cleanup
| u.wg.Wait() | ||
| } | ||
|
|
||
| func (u *UpdateManager) onContextCancel() { |
There was a problem hiding this comment.
You clean up updateManager with Stop and also with context cancellation. This means we have a race condition in the onContextCancel and Stop() functions.
There was a problem hiding this comment.
Added the locking mechanism from the original PR modifications
|



Describe your changes
AlwaysUpdateto AutoUpdate struct, when true, the client will update as soon as possible regardless of time of connection, when false, the client will only update within the first minute of Engine startupUpdating...screen, no actual progress is shown, just that it's updating.Manual testing done
netbird-ui.exe --update.Issue ticket number and link
Stack
Checklist
Documentation
Select exactly one:
Docs PR URL (required if "docs added" is checked)
Paste the PR link from https://github.com/netbirdio/docs here:
https://github.com/netbirdio/docs/pull/__